package com.aqie.easy.math;

import java.util.Arrays;

/**
 * 908. 最小差值 I
 */
public class SmallestRangeI {
    public int smallestRangeI(int[] A, int K) {
        Arrays.sort(A);
        int length = A.length;
        if(A[length - 1] - A[0] <= 2 * K){
            return 0;
        }else{
            return A[length - 1] - A[0] - 2 * K;
        }
    }
}
